package com.hottv.meeting.videomeeting.module.agora;

import android.view.SurfaceView;
import android.view.ViewParent;
import android.widget.RelativeLayout;

import java.io.UnsupportedEncodingException;
/**
 * Created by chengwenqiang on 2019/5/30.
 */

public class AgoraUtils {

    //判读 view是否有父节点，如果有则删除
    public static void checkSurfaceView(SurfaceView view) {
        ViewParent parent = view.getParent();
        if (parent != null) {
            ((RelativeLayout) parent).removeView(view);
        }
    }

    //将byte转化为string
    public static String byteToString(byte[] bytes)
    {
        String str ="";
        try{
            str = new String(bytes,"UTF-8");
        }catch (UnsupportedEncodingException e)
        {
            e.printStackTrace();
        }
        return str;
    }

    public static byte[] stringToByte(String str)
    {

        return str.getBytes();
    }


}
